<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 5 Transitional//EN">
<%@ page pageEncoding="UTF-8" %>
<%@ page import="jp.co.technotree.apl.cmd.spare.Spa1000Bean,jp.co.technotree.apl.api.common.GlobalConst" %>
<%@ page import="jp.co.technotree.apl.api.common.Message" %>
<%@page import="jp.co.technotree.apl.api.common.FwCom"%>
<%@page import="jp.co.technotree.apl.cmd.order.Odr2100Bean"%>
<jsp:useBean id="formBean" class="jp.co.technotree.apl.cmd.order.Odr2100Bean" scope="request" />
<%


%>
<html>
<head>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes"/>
<link rel='stylesheet' type='text/css' href='../../common/css/order/odr2100.css' >
<link rel='stylesheet' type='text/css' href='../../common/css/popUp.css' >

<script type='text/javascript' src='../../common/js/popUp.js'></script>
<script type='text/javascript' src='../../common/js/NumKeyBoard2.js'></script>


<!-- ITEM-DROPDOWN START -->
<link rel="stylesheet" href="../../common/js/dropdown/dropdown.css" type="text/css">
<script src="../../common/js/dropdown/dropdown.js" type="text/javascript"></script>
<!-- ITEM-DROPDOWN END -->

<style type="text/css">

	.mainTbl_Left{
		 border: 0px solid #CCCCFF;
		 height:150px;
		 width: 210px;
		 margin-top:-250px;
		 align:center;
	}

	.mainTbl_Right{
		 border: 0px solid #CCCCFF;
		 height:550px;
	}


	.confirmBtn {
		width: 80px;
		height:50px;
		font-size:18px;
	}
	.confirmBtn2 {
		width: 120px;
		height:50px;
		font-size:18px;
	}

	.selTitle{
	 font-size:16px;
	 valign:middle;

	}

	.ImageZone{
	 position:absolute;
	 top :115px;
	 right:20px;
	 visibility: visible;

	 width: 200px;
	 height:200px;
	}


	.OrderReason{
	 position:absolute;
	 top :90px;
	 left:660px;
	 visibility: visible;

	 width: 300px;
	 height:200px;
	}


.backBtn{
	width: 80px;
	height:50px;
	font-size:18px;
	margin-top:1px;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#6699CC), to(#6699CC),color-stop(0.7,#6688CC));
	color: #fff;
	font-weight:bold;
	text-shadow: -1px 2px rgba(0,0,0,0.2);
	-webkit-border-radius:10px;

	position:relative; z-index:1;
}



.orderBtn{
	width: 80px;
	height:50px;
	font-size:18px;
	margin-top:1px;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#6699CC), to(#6699CC),color-stop(0.7,#6688CC));
	color: #fff;
	font-weight:bold;
	text-shadow: -1px 2px rgba(0,0,0,0.2);
	-webkit-border-radius:10px;

	position:relative; z-index:1;
}
.clearBtn{
	width: 90px;
	height:50px;
	font-size:18px;
	margin-top:1px;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#6699CC), to(#6699CC),color-stop(0.7,#6688CC));
	color: #fff;
	font-weight:bold;
	text-shadow: -1px 2px rgba(0,0,0,0.2);
	-webkit-border-radius:10px;

	position:relative; z-index:1;
}


.searchBtn{
	width: 80px;
	height:50px;
	font-size:18px;
	margin-top:1px;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#6699CC), to(#6699CC),color-stop(0.7,#6688CC));
	color: #fff;
	font-weight:bold;
	text-shadow: -1px 2px rgba(0,0,0,0.2);
	-webkit-border-radius:10px;

	position:relative; z-index:0;
}


     /*-------------------------*/
	 /* dropdown.css*/
	 /*-------------------------*/
	div.dropdown-panel {
		font-size:12px;
		width:150px;
		height:200px;
		border-top:solid 1px #888;
		border-left:solid 1px #888;
		border-right:solid 1px #555;
		border-bottom:solid 1px #000;
		background-color:#fff;
		position:absolute;
		z-index:900;
		display:none;
	}

	div.dropdown-panel-in {
		width:150px;
		height:200px;
		border-top:solid 1px #fff;
		border-left:solid 1px #fff;
		border-right:solid 1px #888;
		border-bottom:solid 1px #888;
		background-color:#eee;

	}

	div.dropdown-panel-in div.header{
		width:100%;
		height:20px;
		border-bottom:solid 1px #000;
		background-color:#acf;
	}

	div.dropdown-panel-in div.drop-contents{
		position:relative;
		width:100%;
		height:176px;
		overflow-y:scroll;

	}

	div.dropdown-panel-in div.footer{
		position:relative;
		width:100%;
		height:2px;
		border-top:solid 1px #000;
		background-color:#cef;
		overflow:hidden;
	}


	div.dropdown-panel table {
		font-size:12px;
	}

	div.drop-contents table {
		width:100%;
		font-size:12px;
	}

	div.drop-contents table tbody tr{
		height:18px;
		cursor:hand;
	}
	div.drop-contents table tbody th{
		height:18px;
	}
	div.drop-contents table tbody td{
		padding-top:2px;
		padding-bottom:2px;
		padding-left:3px;
		padding-right:3px;
		height:18px;
	}



</style>



<script language='javascript'>

//画面固定
//document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);


//<!-- NumKeyBoard START -->
var clsNKB = new CNumKeyBoard();
function onInit(){


	//発注完了後、メッセーを出してメイン画面に遷移
	var stateFlg = "<%=formBean.getStateFlg()%>";
	
	var afterFunc="nextPageJump('top1000');"
	if(stateFlg == "top"){
		//発注処理を正常に完了しました
		alert_Info2("<%=Message.getMessage("INF00020").replace("$1", "発注処理")%>",afterFunc);
	}
	//---------------------------------------------



/* 	var delvOdrObj = document.getElementById("delvOdr"); 	//出庫オーダー
	var useMethObj = document.getElementById("useMeth");	//使用用途
	var usrListObj = document.getElementById("usrList");	//入荷担当者
	var useUsrObj = document.getElementById("useUsr");	//使用者
 */



	var panel = document.getElementById("dropdown-panel");
	var frm=document.main;
	var findItemCdObj=frm["findItemNo"];
	if (findItemCdObj!=null) {
		var targetList = [ findItemCdObj ];
		dropdown = new CItemDropDownList(targetList,panel,"drop-contents");
		dropdown.setKeyUpEvent(text_onKeyUp);
		dropdown.setSelectEvent(list_onSelect);
		dropdown.serverURL="../itm1099/itm1099";
	}

	
	
	

	//-------------------------------------------------------------------------
	//<!-- RACKNO-DROPDOWN START 　設備機番--> 
	var panel2 = document.getElementById("dropdown-panel2");
	
	var findMachineNoObj=document.getElementById("machineNo");
	if (findMachineNoObj!=null) {
		var targetList2 = [ findMachineNoObj ];
		dropdown2 = new CItemDropDownList(targetList2,panel2,"drop-contents2");
		dropdown2.setKeyUpEvent(text_onKeyUp2);
		dropdown2.setSelectEvent(list_onSelect2);
		dropdown2.serverURL="../sys1099/sys1099";
	}
	
	dropdown2.createTable=function(object,sender,json) {
		var itemList = this.itemList;
		var tableText = "<table cellspacing='0' cellpadding='0' border='0' id='"+this.tableName+"'>";
		if (itemList!=null && itemList.length!=0) {
			for ( var i=0; itemList && i<itemList.length; i++ ){
				var item = itemList[i];
				
				tableText+= "<tr>";
				tableText+= "<td>"+item.value1+"</td>";
				tableText+= "</tr>";
			}
		} else {
			tableText+= "<tr>";
			tableText+= "<td>該当なし</td>";
			tableText+= "</tr>";
			tableText+= "</table>";
		}
		tableText+= "</table>";
		
		var canvas = document.getElementById(this.canvasName);
		canvas.innerHTML=tableText;
	}
	//-------------------------------------------------------------------------

	//-------------------------------------------------------------------------
	//<!-- NumKeyBoard START -->
	ProcStart	= new Date();

	clsNKB.init("NumKeyBoardID");
//	clsNKB.parentElement	= document.getElementById("BodyBlock");

	clsNKB.textFontSize		= 20;
	clsNKB.buttonFontSize	= 30;
	clsNKB.boxX				= -200;
	clsNKB.boxY				= 0;
	clsNKB.boxBalloonOffset	= 210;
	//<!-- NumKeyBoard END -->
	//-------------------------------------------------------------------------


}


//-------------------------------------------------------------------------
//<!-- ITEM-DROPDOWN START -->
var dropdown = null;

var inputDateTime = null;
var timerId = null;
var eventSrc={};
function text_onKeyUp(object,sender,evt){
	var value = sender.value;
	eventSrc.object = object;
	eventSrc.sender = sender;
	eventSrc.evt = evt;
	inputDateTime = new Date();

//-----------------------------------------------

	//小文字を大文字へ
	sender.value = sender.value.toUpperCase();
	value = sender.value;

	//品番自動ハイフン「-」を付ける
	var chkLen=5;
	if(event.keyCode != 0008){
		//指定の桁以上ならスタート
		if(value.length>=chkLen){
			var hikaku = value.substring(chkLen, chkLen+1);
			if(hikaku != "-"){
				var frontValue = value.substring(0, chkLen);
				var backValue  = value.substring(chkLen, value.length);
				sender.value=frontValue+"-"+backValue;
			}
		}
	}
	//-----------------------------------------------

	if ( value.length >= <%=formBean.getGohoKensu() %> ){
		if ( evt.keyCode == 37 || evt.keyCode == 39 ){

		}else{
			if ( timerId == null ){
				// 連続送信防止
				timerId = window.setTimeout(function(){text_onTimeOut(object,sender,evt);},500);
			}
		}
	}
}

/**
* 一定時間入力が止まった場合に動作
*/
function text_onTimeOut(object,sender,evt){
	var nowDateTime = new Date();
	var lngTime = (nowDateTime.getTime()-inputDateTime.getTime());
	if ( lngTime >= 1000 ){
		timerId = null;
		xmlRequest(object,sender,evt);
	}else{
		timerId = window.setTimeout(function(){text_onTimeOut(eventSrc.object,eventSrc.sender,eventSrc.evt);},500);
	}
}

/**
* XML要求処理
*/
function xmlRequest(object,sender,evt){
	//alert(evt.keyCode);
	var table = document.getElementById("drop-contents");
	table.innerHTML="";

	var top = calculateOffsetTop(sender);
	var left = calculateOffsetLeft(sender);
	var height = sender.offsetHeight;
	var panel = document.getElementById("dropdown-panel");
	panel.style.top=top+height+"px";
	panel.style.left=left+"px";
	panel.style.display="block";

	var param="itemCd="+sender.value+"&tempFlg=0"+"&delDiv=0";

	try {
		var frm = document.main;
		var objs = frm["invCate"];
		if (objs[1].checked == true){
			//仮入出庫
			param += "&afterProc=1";
		}
	} catch (e) {

	}

	object.doXmlRequest(object,sender,param);
}


/**
* リスト選択時コールバック処理
*/
function list_onSelect(object,sender,json){
	var panel = document.getElementById("dropdown-panel");
	panel.style.display="none";
	sender.focus();

	//----------
	var name=sender.name;
	var idx=name.substring(name.indexOf("[")+1,name.length-1);

	document.getElementById("findItemNo").value=json.itemcd;


	//hidden値として格納
	document.getElementById("itemNm_hid").value=json.itemnm;     	//品番名
	document.getElementById("itemNo1_hid").value=json.itemcd1;		//Y品番1
	document.getElementById("itemNo2_hid").value=json.itemcd2;  	//Y品番2



	document.getElementById("model_hid").value=json.model;      	//型式
	document.getElementById("leadTm_hid").value=json.leadtm;  		//L/T
	document.getElementById("unitPrice_hid").value=json.unitprice;  //単価
	document.getElementById("machineNo_hid").value=json.machineno;  //設備機番
	document.getElementById("machineName_hid").value=json.machinename;  //設備機番名

	document.getElementById("updateDt_hid").value=json.updatedt;    //更新日

//	document.getElementById("odrLot_hid").value=json.odrlot;  		//発注単位
//	document.getElementById("newStock_hid").value=json.newstock;    //新品在庫数
//	document.getElementById("useStock_hid").value=json.usestock;    //中古在庫数
//	document.getElementById("odrPoint_hid").value=json.odrpoint;    //発注点
//	document.getElementById("basicStock_hid").value=json.basicstock;//基準在庫
//
//
    //Y品番を再選択した時に背景色の色を白に戻す
	setBgWhite();


}




//-------------------------------------------------------------------------
//<!-- 設備機番-DROPDOWN START -->
var dropdown2 = null;

var inputDateTime2 = null;
var timerId2 = null;
var eventSrc2={};
function text_onKeyUp2(object,sender,evt){

	
	document.getElementById("machineKey").value = "";   //設備機番キーを削除
	
	var value = sender.value;
	eventSrc2.object = object;
	eventSrc2.sender = sender;
	eventSrc2.evt = evt;
	inputDateTime2 = new Date();
	//-----------------------------------------------

	//品番自動ハイフン「-」を付ける
	var chkLen=4;
	if(event.keyCode != 0008){
		//指定の桁以上ならスタート
		//if(value.length>=chkLen){
		//	var hikaku = value.substring(chkLen, chkLen+1);
		//	if(hikaku != "-"){
		//		var frontValue = value.substring(0, chkLen);
		//		var backValue  = value.substring(chkLen, value.length);
		//		sender.value=frontValue+"-"+backValue;
		//	}
		//}
	}
	//小文字を大文字へ
	sender.value = sender.value.toUpperCase();
	value = sender.value;
	//-----------------------------------------------
	if ( value.length >= 3 ){
		if ( evt.keyCode == 37 || evt.keyCode == 39 ){
			
		}else{
			if ( timerId2 == null ){
				// 連続送信防止
				timerId2 = window.setTimeout(function(){text_onTimeOut2(object,sender,evt);},500);
			}
		}
	}
}

/**
* 一定時間入力が止まった場合に動作
*/
function text_onTimeOut2(object,sender,evt){
	var nowDateTime = new Date();
	var lngTime = (nowDateTime.getTime()-inputDateTime2.getTime());
	if ( lngTime >= 1000 ){
		timerId2 = null;
		
		
		xmlRequest2(object,sender,evt);
	}else{
		timerId2 = window.setTimeout(function(){text_onTimeOut2(eventSrc2.object,eventSrc2.sender,eventSrc2.evt);},500);
	}
}

/**
* XML要求処理
*/
function xmlRequest2(object,sender,evt){
	//alert_Custom(evt.keyCode);
	var table = document.getElementById("drop-contents2");
	table.innerHTML="";
	
	var top = calculateOffsetTop(sender);
	var left = calculateOffsetLeft(sender);
	var height = sender.offsetHeight;
	var panel = document.getElementById("dropdown-panel2");
	panel.style.top=top+height+"px";
	panel.style.left=left+"px";
	panel.style.display="block";
	

	
	var param="sysId=<%=GlobalConst.SETBI_KIBAN%>&"+"value1="+sender.value+"";
	

	try {
		var frm = document.main;
		var objs = frm["invCate"];
		
		if (objs[1].checked == true){
			//仮入出庫
			param += "&afterProc=1";
		}
	} catch (e) {
		
	}

	object.doXmlRequest(object,sender,param);
}


/**
* リスト選択時コールバック処理
*/
function list_onSelect2(object,sender,json){
	var panel = document.getElementById("dropdown-panel2");
	panel.style.display="none";
	sender.focus();
	
	//----------
	var name=sender.name;
	var idx=name.substring(name.indexOf("[")+1,name.length-1);
	
	document.getElementById("machineNo").value=json.value1;
	document.getElementById("machineKey").value=json.valuecd;
	
	
}


function getElementsByClassName2(parent,tagName,className,fullMatch){
	
	alert(tagName);
	var i=0,j=0;
	var result = [], cnt = 0;
	var list = parent.getElementsByTagName(tagName);
	for ( i=0; i<list.length; i++ ){
		var name = list[i].className;
		if ( name ){
			var nameList = name.split(' ');
			for ( j=0; j<nameList.length; j++ ){
				if ( fullMatch ){
					if ( nameList[j] == className ){
						result[cnt++] = list[i];
					}
				}else{
					if ( nameList[j].indexOf(className) != -1 ){
						result[cnt++] = list[i];
					}
				}
			}
		}
	}
	return result;
}
function closeBtn2(){
	var panel = document.getElementById("dropdown-panel2");
	panel.style.display="none";
} 
//----------------------------------------------------------------------





//Y品番を再選択した時に背景色の色を白に戻す
function setBgWhite(){

	var odrDt  =  document.getElementById("odrDt");  				        //発注日
	var delvOdrObj = document.getElementById("delvOdr"); 				   //出庫オーダーOBJ
	var delvOdr = delvOdrObj.options[delvOdrObj.selectedIndex];		       //出庫オーダー
	var useUsrObj = document.getElementById("useUsr");					   //使用者
	var useUsr = useUsrObj.options[useUsrObj.selectedIndex];
	var arrPlanDt  =  document.getElementById("arrPlanDt") 		           //入荷予定年月日
	var useMethTxt = document.getElementById("useMethTxt");				   //使用用途
	var odrUsrObj = document.getElementById("odrUsr");						//発注担当者(組)
	var usrListObj = document.getElementById("usrList");				   //発注担当者
	var usrList = usrListObj.options[usrListObj.selectedIndex];
	var useFacilTxt = document.getElementById("useFacilTxt");				//使用設備
	var usePlanDt  =  document.getElementById("usePlanDt");					//使用予定日
	var odrSeq  =  document.getElementById("odrSeq");						//手配連番
	var machineNo = document.getElementById("machineNo");			        //設備機番
	var leadTime = document.getElementById("leadTm");     		            //L/T
	var orderNum =document.getElementById("orderNum");	    				//発注数量
	
	//============
	 //背景色解除
	 //============
	odrDt.style.backgroundColor = 'white';
	delvOdrObj.style.backgroundColor = 'white';
	useUsrObj.style.backgroundColor = 'white';
	arrPlanDt.style.backgroundColor = 'white';
	useMethTxt.style.backgroundColor = 'white';
	usrListObj.style.backgroundColor = 'white';
	odrUsrObj.style.backgroundColor = 'white';
	useFacilTxt.style.backgroundColor = 'white';
	usePlanDt.style.backgroundColor = 'white';
	odrSeq.style.backgroundColor = 'white';
	machineNo.style.backgroundColor = 'white';
	leadTime.style.backgroundColor = 'white';
	orderNum.style.backgroundColor = 'white';
	
}




function getElementsByClassName(parent,tagName,className,fullMatch){
	var i=0,j=0;
	var result = [], cnt = 0;
	var list = parent.getElementsByTagName(tagName);
	for ( i=0; i<list.length; i++ ){
		var name = list[i].className;
		if ( name ){
			var nameList = name.split(' ');
			for ( j=0; j<nameList.length; j++ ){
				if ( fullMatch ){
					if ( nameList[j] == className ){
						result[cnt++] = list[i];
					}
				}else{
					if ( nameList[j].indexOf(className) != -1 ){
						result[cnt++] = list[i];
					}
				}
			}
		}
	}
	return result;
}
//----------------------------------------------------------------------




//=======================================================select変更連動
//===========================================
//組がが変更された時の処理
//===========================================
//子ノード作成
function selectIn(obj,arrVar,arrTxt){
	var strObject = document.getElementById(obj);
	for(var k=0; k < arrVar.length; k++){
		//optionのvalue属性にセット(key)
		var ele = document.createElement("option");
		ele.value = arrVar[k];
		//optionにセット(value)
		var str = document.createTextNode(arrTxt[k]);
		ele.appendChild(str);

		strObject.appendChild(ele);
	}
}


//子ノード削除
function selectDel(Obj){
	var strObject = document.getElementById(Obj);
	for(var i= strObject.childNodes.length-1; i >= 0;i--) {
		strObject.removeChild(strObject.childNodes[i]);
	}
}


function reformWork(){
	var strWorkCd1Txt= new Array();
	var strWorkNm1Val= new Array();

	var strWorkCd1Txt2= new Array();
	var strWorkNm1Val2= new Array();

	strWorkCd1Txt[0] = "";
	strWorkNm1Val[0] = "";

	strWorkCd1Txt2[0] = "";
	strWorkNm1Val2[0] = "";

	 //=======================================
	 //組リスト取得
	 //=======================================
	 <%
	 Odr2100Bean.PullData[] work1NmPullList =formBean.getInputEmpPullList();

	 for (int j=0; j < work1NmPullList.length; j++){
		 Odr2100Bean.PullData  data = work1NmPullList[j];
 	%>
 		strWorkCd1Txt[<%=j+1%>] = "<%=data.value%>"
	 	strWorkNm1Val[<%=j+1%>] = "<%=data.key%>"
	<%}%>
	   //作業内容の子ノードを削除
	   selectDel("odrUsr");
	   //子ノードを作成
	   selectIn("odrUsr",strWorkNm1Val,strWorkCd1Txt);


	 //=======================================
	 //発注担当リスト取得
	 //=======================================
	 <%
	 Odr2100Bean.PullData[] work2NmPullList =formBean.getInputEmpPullList2();

	 for (int j=0; j < work2NmPullList.length; j++){
		 Odr2100Bean.PullData  data = work2NmPullList[j];
 	%>
 		strWorkCd1Txt2[<%=j+1%>] = "<%=data.value%>"
 		strWorkNm1Val2[<%=j+1%>] = "<%=data.key +"*"+ data.key2%>"
	<%}%>
	   //作業内容の子ノードを削除
	   selectDel("usrList");
	   //子ノードを作成
	   selectIn("usrList",strWorkNm1Val2, strWorkCd1Txt2);


}



//組の区分選択により
function odrUsrSideDell(odrUsr){
	var strWorkCd1Txt= new Array();
	var strWorkNm1Val= new Array();
	var arrCnt=1;
	strWorkCd1Txt[0] = "";
	strWorkNm1Val[0] = "";

	//入荷担当者の子ノードを削除
	selectDel("usrList");

	 <%
		 Odr2100Bean.PullData[] work1ForWork2List =formBean.getInputEmpPullList2();
		 for (int j=0; j < work1ForWork2List.length; j++){
			 Odr2100Bean.PullData  data = work1ForWork2List[j];
	 %>
		 	if(odrUsr.value == "<%=data.key%>"){
		 		strWorkCd1Txt[arrCnt] = "<%=data.value%>"
			 	strWorkNm1Val[arrCnt] = "<%=data.key  +"*"+ data.key2%>"
			 	arrCnt++;
			//組の区分が何も選択ない場合
		 	}else if(odrUsr.value == ""){
		  		reformWork();
		 		return;
		 	}
  	 <%}%>


   //子ノードを作成
   selectIn("usrList",strWorkNm1Val,strWorkCd1Txt);



}


//担当者の区分選択により
function odrUsrSideDell2(usrList){
	var strWorkCd1Txt= new Array();
	var strWorkNm1Val= new Array();
	var arrCnt=1;
	strWorkCd1Txt[0] = "";
	strWorkNm1Val[0] = "";

	//key1とkey2を分ける
	var usrListArr = usrList.value.split("*");


	//入荷担当者の子ノードを削除
	selectDel("odrUsr");

	 <%
		 Odr2100Bean.PullData[] work1ForWorkList =formBean.getInputEmpPullList();
		 for (int j=0; j < work1ForWorkList.length; j++){
			 Odr2100Bean.PullData  data = work1ForWorkList[j];
	 %>
		 	if(usrListArr[0] == "<%=data.key%>"){
		 		strWorkCd1Txt[arrCnt] = "<%=data.value%>"
			 	strWorkNm1Val[arrCnt] = "<%=data.key%>"

			 	arrCnt++;
			//組の区分が何も選択ない場合
		 	}else if(usrList.value == ""){
		  		reformWork();
		 		return;
		 	}
	 <%}%>


 //子ノードを作成
 selectIn("odrUsr",strWorkNm1Val,strWorkCd1Txt);

 //入荷担当者による組の自動選択
 document.getElementById("odrUsr").selectedIndex = 1;

}

//=======================================================select変更連動

//日付を取得
var get_current_timestamp = function() {
    var weeks = new Array('日', '月', '火', '水', '木', '金', '土');
    var d = new Date();

    // 年月日・曜日・時分秒の取得
    var month  = d.getMonth() + 1;
    var day    = d.getDate();
    var week   = weeks[ d.getDay() ];
    var hour   = d.getHours();
    var minute = d.getMinutes();
    var second = d.getSeconds();

    // 1桁を2桁に変換する
    if (month < 10) {month = "0" + month;}
    if (day < 10) {day = "0" + day;}
    if (hour < 10) {hour = "0" + hour;}
    if (minute < 10) {minute = "0" + minute;}
    if (second < 10) {second = "0" + second;}

    // 整形して返却
    return d.getFullYear()  + "-" + month + "-" + day;
    //return d.getFullYear()  + "/" + month + "/" + day + "（" + week + "） " + hour + ":" + minute + ":" + second;
}


function selectedChange(formSelectId, itemValue){
	var objSelect = document.getElementById(formSelectId);
	var m = objSelect.length;
	var i = 0;

	for(i=0;m>i;i++){
		var arr = objSelect.options[i].value.split("*");
		if(arr[1] == itemValue){
			objSelect.options[i].selected = true;
			break;
		}
	}
}


//確定ボタン押下
function confirmBtn(){
	findItemNo = document.getElementById("findItemNo").value;


	//未入力をチェック
	if(findItemNo==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "Y品番")%>"); //$1が入力されていません。
		return;
	}else if(document.getElementById("itemNo1_hid").value ==""){
		alert_Custom("<%=Message.getMessage("WRN01180")%>");
		return;
	}

	//確定時にログインユーザコードをデフォルト値せセット
	selectedChange("usrList",<%=formBean.getUsrListKey()%>);
	odrUsrSideDell2(document.getElementById("usrList"));



	document.getElementById("itemNm").value = document.getElementById("itemNm_hid").value;
	document.getElementById("itemNo1").value = document.getElementById("itemNo1_hid").value;
	document.getElementById("itemNo2").value = document.getElementById("itemNo2_hid").value;
	document.getElementById("model").value = document.getElementById("model_hid").value;
	document.getElementById("unitPrice").value = document.getElementById("unitPrice_hid").value;
	document.getElementById("leadTm").value = document.getElementById("leadTm_hid").value;
	
	document.getElementById("machineNo").value = document.getElementById("machineName_hid").value;  //設備機番に入れ込み
	document.getElementById("machineKey").value = document.getElementById("machineNo_hid").value;  //設備機番に入れ込み

	
	//確定時、設備機番selected
	//selectedChange("machineNo",document.getElementById("machineNo_hid").value);

	
	
	document.getElementById("odrDt").value = get_current_timestamp();	  //発注日（今日の日付を表示）
	document.getElementById("usePlanDt").value = get_current_timestamp(); //使用予定日（今日の日付を表示）


	//document.getElementById("orderNum").value = 0;



	loadText(document.getElementById("odrDt"));  //入荷年月日をセット


}


//数値を3桁区切りで表示
function addFigure(str) {
	 var num = new String(str).replace(/,/g, "");
	 while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
	 return num;
}



//=================================================================
//	データ入力後の処理（看板枚数による発注数量の処理）
//=================================================================
function afterInputData(obj) {

	obj.value = obj.value.replace(",","");  //コンマを除去
	
	if("orderNum" == obj.id){
		//発注数量入力
		document.getElementById("orderNum").value = addFigure(obj.value);

		//０の場合
//		if(obj.value ==0){
//			alert_Custom("<%=Message.getMessage("WRN00060").replace("$1", "発注数量")%>");
//			return ;
//		}
	}else{
		//L/Tの入力
		document.getElementById("leadTm").value = addFigure(obj.value);
		var odrDt = document.getElementById("odrDt");

		//０の場合
//		if(obj.value ==0){
//			alert_Custom("<%=Message.getMessage("WRN00060").replace("$1", "リードタイム")%>");
//			return ;
//		}

		loadText(odrDt);

	}

}
//--------------------------------
//カンマ削除関数
//--------------------------------
function delComma(w) {
  var z = w.replace(/,/g,"");
  return (z);
}

//--------------------------------
//	型変換 String→Numeric
//--------------------------------
function convStrToNum(strVal) {
	var cnv = Number(strVal);
	var res = 0;
	if(isNaN(cnv)) {
		// 数値じゃない!
	} else {
		res = cnv;
	}
	return res;
}
//<!-- NumKeyBoard END -->
//----------------------------------------------------------------------



//=================================================================
//	設備金検索による設備機番セット
//=================================================================
function setMachineSearch() {

	var machineNo = document.getElementById("machineNo");
	var machineKey = document.getElementById("machineKey");
	var machineSearchObj = document.getElementById("machineNoSearch");

	var machine = machineSearchObj.options[machineSearchObj.selectedIndex].value;

	var machineArr = machine.split("*");

	//「設備機番検索」された値を「設備検索」に入れ込み
	machineNo.value=machineArr[0];
	
	
	//設備機番選択時に設備機番selected
	//selectedChange("machineNo",machineArr[1]);

	//machineNo.value = machineArr[0];   //設備機番　value
	machineKey.value = machineArr[1];    //設備機番　key

}


//=================================================================
//	設備機番よる設備機番検索セット
//=================================================================
function setMachineNo() {
	
	//設備機番検索を初期値に
	selectedChange("machineNoSearch",null);

}




function nextPageJump(nextPage){

	mainForm = document.getElementById("F1");
	document.getElementById("nextPage").value = nextPage;

	mainForm.submit();
}


//戻るボタン押下
function backBtn(nextPage){

	mainForm = document.getElementById("F1");
	document.getElementById("nextPage").value = nextPage;
	document.getElementById("orderExe").value = "";  //発注実行を弾くために

	//確定されたものが無いとメイン画面にすぐ遷移
	var itemNo1 = document.getElementById("itemNo1").value;

	if(itemNo1 != ""){
		//発注処理を中止します。よろしいですか？
		if ("undefind"!=confirm_Custom("<%=Message.getMessage("INF01040").replace("$1", "発注処理")%>")){
			return ;
		}
	}


	mainForm.submit();
}




//パップアップ解除
function back(){
	document.getElementById("opAlertBtn").style.display = "none";
	document.getElementById("opAlert").style.display = "none";
	document.getElementById("opAlertButton").style.display = "none";
	document.getElementById("opAlertTop").style.display = "none";
	document.getElementById("allbackgr").style.display = "none";
}






//「発注」ボタン押下
function orderBtn(){

	var itemNo1 = document.getElementById("itemNo1").value;

	//確定されたものが無いと無視
	if(itemNo1 == ""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "Y品番")%>");
		return;
	}


	//確定時と発注時の更新日を比較
	 updateDtCheck();

}


//「クリア」ボタン押下
function clearBtn(){
	document.getElementById("nextPage").value = "";

	mainForm = document.getElementById("F1");
	document.getElementById("clearExe").value = "1";
	document.getElementById("orderExe").value = "";  //発注実行を弾くために

	//画面の内容を全てクリアします。よろしいですか？
	if ("undefind"!=confirm_Custom("<%=Message.getMessage("INF01010")%>")){
		return ;
	}

	mainForm.submit();
}





//入力チェックによる背景色を付ける
function validCheck(){
	
	var odrDt  =  document.getElementById("odrDt");  				        //発注日
	
	var delvOdrObj = document.getElementById("delvOdr"); 				   //出庫オーダーOBJ
	var delvOdr = delvOdrObj.options[delvOdrObj.selectedIndex];		       //出庫オーダー

	var useUsrObj = document.getElementById("useUsr");					   //使用者
	var useUsr = useUsrObj.options[useUsrObj.selectedIndex];
	
	var arrPlanDt  =  document.getElementById("arrPlanDt") 		           //入荷予定年月日
	var useMethTxt = document.getElementById("useMethTxt");				   //使用用途
	 
	var odrUsrObj = document.getElementById("odrUsr");						//発注担当者(組)
	var usrListObj = document.getElementById("usrList");				   //発注担当者
	var usrList = usrListObj.options[usrListObj.selectedIndex];

	var useFacilTxt = document.getElementById("useFacilTxt");				//使用設備
	var usePlanDt  =  document.getElementById("usePlanDt");					//使用予定日
	var odrSeq  =  document.getElementById("odrSeq");						//手配連番
	var machineKey = document.getElementById("machineKey");			    //設備機番キー
	var leadTime = document.getElementById("leadTm");     		            //L/T
	var orderNum =document.getElementById("orderNum");	    //発注数量
	
	//============
	 //背景色付ける
	 //============
	 if(odrDt.value==""){
		odrDt.style.backgroundColor = 'pink';
	 }
	 if(delvOdr.value==""){
		 delvOdrObj.style.backgroundColor = 'pink';
	 }
	 if(useUsr.value==""){
		 useUsrObj.style.backgroundColor = 'pink';
	 }
	 if(arrPlanDt.value==""){
		 arrPlanDt.style.backgroundColor = 'pink';
	 }
	 if(useMethTxt.value==""){
		 useMethTxt.style.backgroundColor = 'pink';
	 }
	 if(usrList.value==""){
		 usrListObj.style.backgroundColor = 'pink';
		 odrUsrObj.style.backgroundColor = 'pink';
	 }
	 if(useFacilTxt.value==""){
		 useFacilTxt.style.backgroundColor = 'pink';
	 }
	 if(usePlanDt.value==""){
		 usePlanDt.style.backgroundColor = 'pink';
	 }
	 if(odrSeq.value==""){
		 odrSeq.style.backgroundColor = 'pink';
	 }
	 if(machineKey.value==""){
		 machineNo.style.backgroundColor = 'pink';
	 }
	 if(leadTime.value==""){
		 leadTime.style.backgroundColor = 'pink';
	 } 
	 if(orderNum.value==""){
		 orderNum.style.backgroundColor = 'pink';
	 } 
	  
	 
	 
	 //============
	 //背景色解除
	 //============
	 if(odrDt.value!=""){
		odrDt.style.backgroundColor = 'white';
	 }
	 if(delvOdr.value!=""){
		delvOdrObj.style.backgroundColor = 'white';
	 }
	 if(useUsr.value!=""){
		 useUsrObj.style.backgroundColor = 'white';
	 }
	 if(arrPlanDt.value!=""){
		 arrPlanDt.style.backgroundColor = 'white';
	 }
	 if(useMethTxt.value!=""){
		 useMethTxt.style.backgroundColor = 'white';
	 }
	 if(usrList.value!=""){
		 usrListObj.style.backgroundColor = 'white';
		 odrUsrObj.style.backgroundColor = 'white';
	 }
	 if(useFacilTxt.value!=""){
		 useFacilTxt.style.backgroundColor = 'white';
	 }
	 if(usePlanDt.value!=""){
		 usePlanDt.style.backgroundColor = 'white';
	 }
	 if(odrSeq.value!=""){
		 odrSeq.style.backgroundColor = 'white';
		 
	 }
	 if(machineKey.value!=""){
		 machineNo.style.backgroundColor = 'white';
	 }
	 if(leadTime.value!=""){
		 leadTime.style.backgroundColor = 'white';
	 }
	 if(orderNum.value!=""){
		 orderNum.style.backgroundColor = 'white';
	 }
}


//「発注」実行
function orderBtnExe(){
	mainForm = document.getElementById("F1");

	//======================================
	//新品在庫数と中古在庫数チェック
	//看板枚数×発注単位 > 新品在庫数＋中古在庫数、かつ新品在庫数 + 中古在庫数 <>0 のときはエラーメッセージを出力後、処理を抜ける
	//=======================================
	var odrPoint =document.getElementById("odrPoint_hid").value;	//発注点
	var basicStock =document.getElementById("basicStock_hid").value;//基準在庫

	var newStock =document.getElementById("newStock_hid").value;
	var useStock =document.getElementById("useStock_hid").value;

	var orderNum =document.getElementById("orderNum").value;	    //発注数量
	var orderNumMinus =  orderNum.indexOf("-");

	var totalStock =Number(newStock) + Number(useStock);

	// alert("newStock :"+newStock);
	// alert("useStock :"+useStock);
	// alert("totalStock :"+totalStock);
	// alert("orderNum :"+orderNum);
	// alert("totalStock - orderNum :"+ (totalStock - Number(orderNum)));




//	if(totalStock == 0){
//		alert_Custom("<%=Message.getMessage("WRN01190")%>");
//		return;
//	}else if(totalStock < orderNum){
//		alert_Custom("<%=Message.getMessage("WRN01190")%>");
//		return;
//	}else if(odrPoint < (totalStock - Number(orderNum))){
//		alert_Custom("<%=Message.getMessage("WRN01080").replace("$1", "発注点")%>");
//		return;
//	}else if(basicStock < (totalStock - Number(orderNum))){
//		alert_Custom("<%=Message.getMessage("WRN01080").replace("$1", "基準在庫数")%>");
//		return;
//	}



   //----------------------------------------------


	var delvOdrObj = document.getElementById("delvOdr"); 				//出庫オーダー
	var delvOdr = delvOdrObj.options[delvOdrObj.selectedIndex].value;

	var useMeth = document.getElementById("useMethTxt").value;				//使用用途
	//var useMeth = useMethObj.options[useMethObj.selectedIndex].value;

	var leadTime = document.getElementById("leadTm");     		            //L/T
	
	var usrListKey = document.getElementById("usrListKey");		//発注担当者 キー
	var usrListObj = document.getElementById("usrList");				//発注担当者
	var usrListArr = usrListObj.options[usrListObj.selectedIndex].value.split("*");

	if(usrListArr[1]){
		usrListKey.value = usrListArr[1];
	}else{
		usrListKey.value ="";
	}

	var useUsrObj = document.getElementById("useUsr");					//使用者
	var useUsr = useUsrObj.options[useUsrObj.selectedIndex].value;

	var odrDt  =  document.getElementById("odrDt").value;  				//発注日

	var arrPlanDt  =  document.getElementById("arrPlanDt").value 		 //入荷年月日

	var useFacilTxt = document.getElementById("useFacilTxt").value;			//使用設備

	var usePlanDt  =  document.getElementById("usePlanDt").value;			//使用予定日

	var odrSeq  =  document.getElementById("odrSeq").value;				 //手配連番

	var machineKey = document.getElementById("machineKey");			     //設備機番キー
	var machineNo = document.getElementById("machineNo");			 //設備機番OBJ
	
	//var machineNoArr = machineNoObj.options[machineNoObj.selectedIndex].value.split("*");//設備機番
	
	//if(machineNoArr[1]){
	//	machineKey.value = machineNoArr[1];
	//}else{
	//	machineKey.value ="";
	//}

	
	validCheck();//入力チェックによる背景色を付ける
	
	
	
	//入力チェック
	if(odrDt ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "発注日")%>");
		return ;
	}else if(useFacilTxt ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "使用設備")%>");
		return ;
	}else if(useMeth ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "使用用途")%>");
		return ;
	}else if(usePlanDt ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "使用予定日")%>");
		return ;
	}else if(leadTime.value ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "L/T")%>");
		return ;
	}else if(delvOdr ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "出庫オーダー")%>");
		return ;
	}else if(orderNum ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "発注数")%>");
		return ;
	}else if(orderNum =="0" || orderNumMinus == 0){
		alert_Custom("<%=Message.getMessage("WRN00060").replace("$1", "発注数")%>");
		return ;
	}else if(odrSeq ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "手配連番")%>");
		return ;
	}else if(arrPlanDt ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "入荷年月日")%>");
		return ;
	}else if(machineKey.value ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "設備機番")%>");
		return ;
	}else if(usrListKey.value ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "入荷担当者")%>");
		return ;
	}else if(useUsr ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "使用者")%>");
		return ;
	}else if(odrDt > arrPlanDt){
		alert_Custom("<%=Message.getMessage("WRN00040").replace("$1", "入荷予定年月日").replace("$2", "発注日")%>");
		return ;
	}else{


		//新品在庫数 = 新品在庫数 - 発注数量
		//中古在庫数 = 中古在庫数

		if(Number(newStock) >= Number(orderNum)){

			document.getElementById("newStock_hid").value = (Number(newStock) - Number(orderNum));

		}else{
		//中古在庫数 = 中古在庫数 - (発注数量 - 新品在庫数)

			document.getElementById("useStock_hid").value = Number(useStock) - (Number(orderNum) - Number(newStock));
		}


		document.getElementById("orderExe").value = "1";


		if ("undefind"!=confirm_Custom("<%=Message.getMessage("INF01030").replace("$1", "予備品")%>")){
			return ;
		}


		mainForm.submit();

	}

}


//使用用途SELECTによる使用用途TEXTにセット
function setUseMeth(){

	var useMethSel = document.getElementById("useMeth");
	var useMethTxt = document.getElementById("useMethTxt");

	useMethTxt.value = useMethSel.options[useMethSel.selectedIndex].text;
}



//使用設備SELECTによる使用設備TEXTにセット
function setUseFacil(){

	var useFacilSel = document.getElementById("useFacil");
	var useFacilTxt = document.getElementById("useFacilTxt");

	useFacilTxt.value = useFacilSel.options[useFacilSel.selectedIndex].text;
}





//*************************************************
//AJAX 部分(発注日による入荷年月日の計算処理)
//*************************************************
function loadText(obj){

	var leadTime = document.getElementById("leadTm").value;

	//leadTimeがNULLなら１をセット
//	if(leadTime=='0'){
//		leadTime = 1;
//	}

	//leadTimeがNULLまた""なら弾かれる
	if(leadTime != "" && leadTime!=null){

		xmlHttp = new XMLHttpRequest();
		xmlHttp.onreadystatechange = checkStatus;
		xmlHttp.open("GET","../odr1001/odr1001?orderDt="+obj.value+"&leadTm="+leadTime,true);
		xmlHttp.send(null);

	}
}

function checkStatus(){
	if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
		var xml = xmlHttp.responseXML;
		var rootNodes = xml.getElementsByTagName("list");
		var rootNode = rootNodes[0];
		var json = JSONConvert(rootNode);
		if (json==null) {

		}else {

			//入荷年月日セット
			document.getElementById("arrPlanDt").value = json.date;
		}
	}
}

function JSONConvert(node){
	var type = node.nodeType;
	if ( isTextNode(node) ){
		var text = getTextValue(node);
		return text;
	}
	if ( type==1 ){
		var json = {};
		var nodeName = node.nodeName;
		var childs = node.childNodes;

		for (var i = 0; i<childs.length; i++){
			var child = childs[i];
			var obj = json[child.nodeName];

			if ( child.nodeType == 1 ){
				if ( obj ){
					var array = null;
					if ( !isArray(obj) ){
						array=[];
						array[array.length]=obj;
					}else{
						array=json[child.nodeName];
					}
					array[array.length]=JSONConvert(child);
					json[child.nodeName]=array;
				}else{
					json[child.nodeName]=JSONConvert(child);
				}
			}
		}
		return json;
	}
}

function isTextNode(node){
	if ( node.hasChildNodes() ){
		var childs = node.childNodes;
		for (var i = 0; i<childs.length; i++){
			var child = childs[i];
			if ( child.nodeType != 3 ) return false;
		}
	}
	return true;
}

function getTextValue(node){
	if ( node.hasChildNodes() ){
		var childs = node.childNodes;
		var child = childs[0];
		if ( child.nodeType == 3 ){
			return child.nodeValue;
		}
	}
	return null;
}
//------------------------------------------------------------------------------


//*************************************************
//AJAX 部分(確定時と発注時の更新日を比較)
//*************************************************
function updateDtCheck(){

	var findItemNo = document.getElementById("itemNo1").value + "-" +document.getElementById("itemNo2").value;
	
	
	xmlHttp = new XMLHttpRequest();
	xmlHttp.onreadystatechange = checkStatus2;
	xmlHttp.open("GET","../odr1002/odr1002?itemCd="+findItemNo,true);
	xmlHttp.send(null);

}

function checkStatus2(){
	if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
		var xml = xmlHttp.responseXML;
		var rootNodes = xml.getElementsByTagName("list");
		var rootNode = rootNodes[0];
		var json = JSONConvert(rootNode);
		if (json==null) {
		}else {
			var orderUpdateDt = json.updatedt;
			var confirmUdateDt = document.getElementById("updateDt_hid").value;


			//確定時と発注時の更新日を比較
			if(orderUpdateDt == confirmUdateDt){
				document.getElementById("updateDtFlg").value = "1";
				orderBtnExe(); //発注実行

			}else{

				alert_Custom("<%=Message.getMessage("WRN01010")%>");
				//予備品のマスタ情報が既に変更されています。発注を再度やり直して下さい。
				return;
			}

		}
	}
}




function selectedChange2(formSelectId, itemValue){
	var objSelect = document.getElementById(formSelectId);
	var m = objSelect.length;
	var i = 0;
	for(i=0;m>i;i++){
		if(objSelect.options[i].value == itemValue){
			objSelect.options[i].selected = true;
			break;
		}
	}
}



//発注方法リスト内容取得
function reformOrderPlan(){
	var strWorkCd1Txt= new Array();
	var strWorkNm1Val= new Array();


	strWorkCd1Txt[0] = "";
	strWorkNm1Val[0] = "";


	 //=======================================
	 //組リスト取得
	 //=======================================
	 <%
	 Odr2100Bean.PullData[] ReInputHatjuKbnList =formBean.getInputHatjuKbnList();

	 for (int j=0; j < ReInputHatjuKbnList.length; j++){
		 Odr2100Bean.PullData  data = ReInputHatjuKbnList[j];
 	%>
 		strWorkCd1Txt[<%=j+1%>] = "<%=data.value%>"
	 	strWorkNm1Val[<%=j+1%>] = "<%=data.key%>"
	<%}%>
	   //作業内容の子ノードを削除
	   selectDel("OrderPlan");
	   //子ノードを作成
	   selectIn("OrderPlan",strWorkNm1Val,strWorkCd1Txt);

}


//発注方法の選択時に「はい」を押下すると、該当するページに遷移
function orderPlanSelected(orderPlan){

	if(orderPlan != "00002"){
		if(orderPlan == "00003"){
			nextPageJump("odr2000");//引当

		}else if(orderPlan == "00005"){
			nextPageJump("odr2200");//買入　継続

		}else if(orderPlan == "00006"){
			nextPageJump("odr2300");//買入　スポット

		}else if(orderPlan == "00004"){
			nextPageJump("odr2400");//特調伝票
		}
	}

}



//発注方法
function orderPlanChange(){

	var Obj = document.getElementById("OrderPlan");
	var orderPlan = Obj.options[Obj.selectedIndex].value;

	document.getElementById("orderExe").value = "";  //発注実行を弾くために

	//確定されたものが無いと発注変更の確認メッセーを出す
	var itemNo1 = document.getElementById("itemNo1").value;

	if(itemNo1 != ""){
		//発注方法の変更のため、画面の内容を全てクリアします。よろしいですか？
		if ("undefind"!=confirm_Custom2("<%=Message.getMessage("INF01020")%>",orderPlan)){

			//「発注方法」リスト内容削除
 			selectDel("OrderPlan");

			//発注方法SELECTEDを元に戻す
			reformOrderPlan();

			//引当に再セット
			selectedChange2(Obj.id,"00002");

			return ;
		}
	}


	if(orderPlan != "00002"){
		if(orderPlan == "00003"){
			nextPageJump("odr2000");//引当

		}else if(orderPlan == "00005"){
			nextPageJump("odr2200");//買入　継続

		}else if(orderPlan == "00006"){
			nextPageJump("odr2300");//買入　スポット

		}else if(orderPlan == "00004"){
			nextPageJump("odr2400");//特調伝票
		}
	}

}



function closeBtn(){
	var panel = document.getElementById("dropdown-panel");
	panel.style.display="none";
}


</script>


</head>

<body onLoad="onInit()">
<form name="main" id="F1" action="./odr2100" method="post" class="frmMain">

<table style="">
	<!--HEADER TITLE START -->
	<tr style = "background-color:#e1e1e1;  font-weight: bold;  border-bottom:1px solid #e1e1e1; background: -webkit-gradient(linear, left top, left bottom, from(#e1e1e1), to(#ffffff));　 ">
		<td colspan="2" class ="header_tbl" style = "font-size:22px; height:40px;"  align = "left">
			　予備品管理システム (<%=formBean.kojou%>)　　　
			<span style="font-size:30px; text-shadow:2px 2px #666; 	color:#aaa;">直結看板以外新規発注画面(MA直接)</span>
		</td>
	</tr>
	<!--HEADER TITLE END -->


	<!--メインメニュー画面　START  -->
	<tr style="height:628px; ">

		<td>
			<table width ="100%"  class="mainTbl_Left">
				<!--発注 -->

				<tr>
					<td id="" align = "left"  class="selTitle" valign="bottom">　&nbsp;発注方法:</td>
				</tr>
				<tr>
					<td id="" align = "right"  class="selTitle" valign="top">
						<select name="OrderPlan"  id="OrderPlan"  onChange="orderPlanChange();" style="width:160px; height:33px; font-size:15px; color:blue;">
								<%
								Odr2100Bean.PullData[] inputHatjuKbnList = formBean.getInputHatjuKbnList();
								for (int i = 0; inputHatjuKbnList != null && i < inputHatjuKbnList.length; i++) {
									Odr2100Bean.PullData data = inputHatjuKbnList[i];
								%>
								<option value='<%=data.key%>' <%=data.selected%> ><%=data.value%></option>
								<%}%>
						</select>　</td>
				</tr>
				
				<tr>
					<td id="" align = "right"  valign="baseline" class="selTitle"><br>Y品番:
					<input type="text"  class="item" name="findItemNo" id="findItemNo" maxlength="11"  value="" size="10"   style="width: 100px; height:25px; font-size:15px; color:blue;" onKeyup="dropdown.OnKeyUpObserver(dropdown,event);" onFocus="dropdown.OnFocusObserver(dropdown,event);" onBlur="dropdown.OnBlurObserver(dropdown,event);">　</td>
				</tr>
				
				<tr>
					<td align = "center" ><br>
						　　　<input type="button" onclick="confirmBtn();" class="searchBtn" value="確 定" >
					</td>
				</tr>
			</table>

		</td>


		<td class="right" >
			 <!--<div class="mainLine" id = "mainLine" style="display:inline; " ></div>  -->

			<table width ="100%"  class="mainTbl_Right">
				<!--発注 -->
				<tr>
					<td id="" align = "left"  class="selTitle">　Y品番: 　
					<input type="text"  class="" name="itemNo1" id="itemNo1" style="width: 42px; height:25px; font-size:14px; color:blue; text-align: right; background-color:#CCC;"  value=""  readonly> -
					<input type="text"  class="" name="itemNo2" id="itemNo2" style="width: 42px; height:25px; font-size:14px; color:blue; text-align: right; background-color:#CCC;"  value=""  readonly>
					</td>

					<td id="" align = "left"   class="selTitle">　発注日:
					<input type="date"  class="" name="odrDt" id="odrDt" style="width: 92px; height:30px; font-size:15px; color:blue;" value=""  onChange="loadText(this);"></td>
				</tr>
				<tr>
					<td id="" align = "left"   valign="top"  class="selTitle" colspan="2">　品名:　　
					<textarea name="itemNm" id="itemNm" cols="40" rows="2"  maxlength="100"  style="width:  310px; font-size:15px; color:blue; background-color:#CCC;" readonly></textarea>

					</td>
				</tr>
                <tr>
					<td id="" align = "left"   valign="top"  class="selTitle" colspan="2" >　型式:　　
					<textarea name="model" id="model" cols="40" rows="2"  maxlength="100"  style="width:  310px; font-size:15px; color:blue; background-color:#CCC;" readonly></textarea>

					</td>
				</tr>
				<tr>
					<td id="" align = "left"   class="selTitle">　単価:　　
					<input type="text"  class="" name="unitPrice" id="unitPrice" style="width: 100px; height:25px; font-size:15px; color:blue; text-align:right; background-color:#CCC;" value="" readonly></td>

					<td id="" align = "left"   class="selTitle">　L/T:
					<input type="text"  class="" name="leadTm" id="leadTm"  maxlength="3"  onclick='clsNKB.setNumKeyBoard(this, 3, 0, false, 200);' onChange='afterInputData(this);' style="width: 100px; height:25px; font-size:15px; color:blue; text-align:right;" value="" readonly></td>

					<td id="" align = "left"   class="selTitle">　出庫オーダー:　
						<select name="delvOdr"  id="delvOdr"  style="width:115px; height:33px; font-size:15px; color:blue;" onChange="">
								<option value=''></option>
								<%
								Odr2100Bean.PullData[] inputDelvOdrList = formBean.getInputDelvOdrList();
								for (int i = 0; inputDelvOdrList != null && i < inputDelvOdrList.length; i++) {
									Odr2100Bean.PullData data = inputDelvOdrList[i];
								%>
								<option value='<%=data.key%>' <%=data.selected%> ><%=data.value%></option>
								<%}%>
						</select>
					</td>
				</tr>
				<tr>
					<td id="" align = "left"   class="selTitle">　発注数量:
					<input type="text"  class="" name="orderNum" id="orderNum"  onclick='clsNKB.setNumKeyBoard(this, 5, 0, true, 200);' onChange='afterInputData(this);' style="width: 100px; height:25px; font-size:15px; color:blue; text-align:right;" value="" readonly></td>

					<td id="" align = "left"   class="selTitle">手配連番:
					<input type="text"  class="" name="odrSeq" id="odrSeq" maxlength="11" style="width: 100px; height:25px; font-size:15px; color:blue;"  value=""></td>
					<td id="" align = "left"   class="selTitle">　　入荷年月日:　
					<input type="date"  class="" name="arrPlanDt" id="arrPlanDt" style="width: 100px; height:33px; font-size:15px; color:blue;"  value=""></td>
				</tr>


				<tr>
					<td id="" align = "left"   class="selTitle">　設備機番:
					<input type="text"  class="machine" name="machineNo" id="machineNo" maxlength="11"  value="" size="10"   style="width: 100px; height:25px; font-size:15px; color:blue;" onKeyup="dropdown2.OnKeyUpObserver(dropdown2,event);" onFocus="dropdown2.OnFocusObserver(dropdown,event);" onBlur="dropdown2.OnBlurObserver(dropdown2,event);">
						
						<!-- 
						<select name="machineNo"  id="machineNo"  style="width:130px; height:33px; font-size:15px; color:blue;" onChange='setMachineNo();'>
								<option value=''></option>
								<%
								Odr2100Bean.PullData[] inputMachineNmList3 = formBean.getInputMachineNmList();
								for (int i = 0; inputMachineNmList3 != null && i < inputMachineNmList3.length; i++) {
									Odr2100Bean.PullData data = inputMachineNmList3[i];
								%>
								<option value='<%=data.key +"*"+ data.key2 %>' <%=data.selected%> ><%=data.key%></option>
								<%}%>
						</select>
						 -->
					</td>



					<td id="" align = "left"   class="selTitle" colspan="3">　設備機番検索:
						<select name="machineNoSearch"  id="machineNoSearch"  style="width:400px; height:33px; font-size:15px; color:blue;" onChange='setMachineSearch();'>
								<option value=''></option>
								<%
								Odr2100Bean.PullData[] inputMachineNmList = formBean.getInputMachineNmList();
								for (int i = 0; inputMachineNmList != null && i < inputMachineNmList.length; i++) {
									Odr2100Bean.PullData data = inputMachineNmList[i];
								%>
								<option value='<%=data.key+ "*" +data.key2%>' <%=data.selected%> ><%=data.value%></option>
								<%}%>
						</select>
					</td>

				</tr>

				<!--線を引く -->
				<tr><td  colspan="4"><hr></td></tr>

				<tr>
					<td id="" align = "left"   class="selTitle" colspan="2">　入荷担当者:
						<select name="odrUsr"  id="odrUsr"  style="width:100px; height:30px; font-size:15px; color:blue;" onChange="odrUsrSideDell(this);">
								<option value=''></option>
								<%
								Odr2100Bean.PullData[] inputEmpPullList = formBean.getInputEmpPullList();
								for (int i = 0; inputEmpPullList != null && i < inputEmpPullList.length; i++) {
									Odr2100Bean.PullData data = inputEmpPullList[i];
								%>
								<option value='<%=data.key%>' <%=data.selected%> ><%=data.value%></option>
								<%}%>
						</select>
						<select name="usrList"  id="usrList"  style="width:100px; height:30px; font-size:15px; color:blue;" onChange="odrUsrSideDell2(this);">
								<option value=''></option>
								<%
								Odr2100Bean.PullData[] inputEmpPullList2 = formBean.getInputEmpPullList2();
								for (int i = 0; inputEmpPullList2 != null && i < inputEmpPullList2.length; i++) {
									Odr2100Bean.PullData data = inputEmpPullList2[i];
								%>
								<option value='<%=data.key + "*" + data.key2%>' <%=data.selected%> ><%=data.value%></option>
								<%}%>
						</select>
					</td>


					<td id="" align = "right"   class="selTitle">使用者:
						<select name="useUsr"  id="useUsr"  style="width:150px; height:30px; font-size:15px; color:blue;" onChange="">
								<option value=''selected></option>
								<%
								Odr2100Bean.PullData[] inputUseUsrList = formBean.getInputUseUsrList();
								for (int i = 0; inputUseUsrList != null && i < inputUseUsrList.length; i++) {
									Odr2100Bean.PullData data = inputUseUsrList[i];
								%>
								<option value='<%=data.key%>' <%=data.selected%> ><%=data.value%></option>
								<%}%>
						</select>
					</td>
				</tr>
				<tr>
					<td></td>
					<td align = "right" >
						<input type="button"  onclick="clearBtn();" class="clearBtn"  value="クリア">　
					</td>
					<td align = "right" >
						<input type="button"  onclick="orderBtn();" class="orderBtn"  value="発注">　　
					</td>
					<td align = "right" >
						<input type="button"  onclick="backBtn('top1000');" class="backBtn"  value="戻る">　
					</td>
				</tr>
			</table>

			<!-- 発注理由 -->
			<div class="OrderReason">
			<table border="1" style="border-color: #CCCCCF;">
				<tr>
					<td>　【発注理由】</td>
				</tr>
				<tr>
					<td id="" align="left"   class="selTitle">　使用設備:　
						<input type="text"  class="" name="useFacilTxt" id="useFacilTxt" maxlength="50"   style="width: 110px; height:25px; font-size:15px; color:blue; text-align:left;" value="" >
						<select name="useFacil"  id="useFacil"  style="width:22px; height:35px;  font-size:15px; color:blue;" onChange='setUseFacil(this);'>
								<option value=''></option>
								<%
								Odr2100Bean.PullData[] inputMachineNmList2 = formBean.getInputMachineNmList2();
								for (int i = 0; inputMachineNmList2 != null && i < inputMachineNmList2.length; i++) {
									Odr2100Bean.PullData data = inputMachineNmList2[i];
								%>
								<option value='<%=data.key%>' <%=data.selected%> ><%=data.value%></option>
								<%}%>
						</select>
					</td>
				</tr>
				<tr>
					<td id="" align="left"   class="selTitle">　使用用途:　
					<input type="text"  class="" name="useMethTxt" id="useMethTxt" maxlength="50"  style="width: 110px; height:25px; font-size:15px; color:blue; text-align:left;" value="" >

						<select name="useMeth"  id="useMeth"  style="width:22px; height:35px; font-size:15px; color:blue;" onChange='setUseMeth(this);'>
								<option value=''></option>
								<%
								Odr2100Bean.PullData[] inputUseMethList = formBean.getInputUseMethList();
								for (int i = 0; inputUseMethList != null && i < inputUseMethList.length; i++) {
									Odr2100Bean.PullData data = inputUseMethList[i];
								%>
								<option value='<%=data.key%>' <%=data.selected%> ><%=data.value%></option>
								<%}%>
						</select>
					</td>
				</tr>
				<tr>
					<td id="" align="left"   class="selTitle">　使用予定日:
						<input type="date"  class="" name="usePlanDt" id="usePlanDt" style="width: 135px; height:30px; font-size:15px; color:blue;"  value="">
					</td>
				</tr>
			</table>
			</div>

			<!--ログインMAIN画面　END  -->

		</td>
	</tr>
</table>
	<div class='footer' align='right' style="font-size:35px; background-image: url(../../common/img/toyotaB.png); background-repeat: no-repeat; align:top;" ></div>
<!-- <div class='ImageZone' align='right' style="font-size:20px; align:top"><img src='../../common/img/XXX.gif' height='180px' width='200px'></div>  -->
	<div id="NumKeyBoardID"></div>

	<input type="hidden" id="nextPage" name="nextPage" value="">

	<!--警告 ポップアップ---------------------------------------------------------------------------- -->
	<div id="allbackgr" class="allbackgr" style="display:none;"></div>
	<div class="opAlertBtn" id = "opAlertBtn" style="display:none;" ></div>
	<div class="opAlertButton" id = "opAlertButton" style="display:none;" ></div>
	<div class="opAlertTop" id = "opAlertTop" style="display:none; font-size:22px;">　予備品管理システム　</div>
	<div class="opAlert" id = "opAlert" style="display:none;"></div>
	<!-- -------------------------------------------------------------------------------------------- -->



	<!-- ITEM-DROPDOWN START -->
	<div class="dropdown-panel" id="dropdown-panel">
		<div class="dropdown-panel-in">
			<div class="header">
				<div style="float:left;width:110px;height:20px;">
					<table border=0>
						<tr>
							<td style="width:110px;height:20px;">品番</td>
						</tr>
					</table>
				</div>
				<div style="float:right;width:40px;text-align:right;">
					<button class="closebtn" type="button" onClick="closeBtn();" style="width:18px; height:17px; padding:0px;">
						<img src="../../common/js/dropdown/close.gif" alt="閉じる">
					</button>
				</div>
			</div>
			<div class="drop-contents" id="drop-contents">
			</div>
			<div class="footer"></div>
		</div>
	</div>
	<!-- ITEM-DROPDOWN END -->

	<!-- MACHINE-DROPDOWN START -->
	<div class="dropdown-panel" id="dropdown-panel2">
		<div class="dropdown-panel-in">
			<div class="header">
				<div style="float:left;width:110px;height:20px;">
					<table border=0>
						<tr>
							<td style="width:110px;height:20px;">設備機番</td>
						</tr>
					</table>
				</div>
				<div style="float:right;width:40px;text-align:right;">
					<button class="closebtn" type="button" onClick="closeBtn2();" style="width:18px;height:17px; padding:0px;">
						<img src="../../common/js/dropdown/close.gif" alt="閉じる">
					</button>
				</div>
			</div>
			<div class="drop-contents" id="drop-contents2">
			</div>
			<div class="footer"></div>
		</div>
	</div>
	<!-- MACHINE-DROPDOWN END -->


	<input type="hidden" id="nextPage" name="nextPage" value="">

	<input type="hidden" id="itemNm_hid" name="itemNm_hid" value="">
	<input type="hidden" id="itemNo1_hid" name="itemNo1_hid" value="">
	<input type="hidden" id="itemNo2_hid" name="itemNo2_hid" value="">
	<input type="hidden" id="model_hid" name="model_hid" value="">
	<input type="hidden" id="unitPrice_hid" name="unitPrice_hid" value="">
	<input type="hidden" id="leadTm_hid" name="leadTm_hid" value="">
	<input type="hidden" id="machineNo_hid" name="machineNo_hid" value="">
	<input type="hidden" id="machineName_hid" name="machineName_hid" value="">
	<input type="hidden" id="odrLot_hid" name="odrlot_hid" value="">
	<input type="hidden" id="updateDt_hid" name="updateDt_hid" value="">

	<input type="hidden" id="newStock_hid" name="newStock_hid" value="">
	<input type="hidden" id="useStock_hid" name="useStock_hid" value="">
	<input type="hidden" id="odrPoint_hid" name="odrPoint_hid" value="">
	<input type="hidden" id="basicStock_hid" name="basicStock_hid" value="">

	<input type="hidden" id="orderExe" name="orderExe" value="">
	<input type="hidden" id="clearExe" name="clearExe" value="">
	<input type="hidden" id="updateDtFlg" name="updateDtFlg" value="">

	<input type="hidden" id="stateFlg" name="stateFlg" value="">
	<input type="hidden" id="usrListKey" name="usrListKey" value="">
	<input type="hidden" id="machineKey" name="machineKey" value="">
</form>
</body>
</html>
